﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace Asion.Dapper.SqlBuilder
{
    public class SimpleCrudSqlServerBuilder<TEntity> : AbstractSimpleCrudSqlBuilder<TEntity> where TEntity : IEntity
    {

     /*   public override string EncapSulation(string name)
        {
            return $"[{name}]";
        }*/


        public override string GetIdentitySql()
        {
            return string.Format("SELECT CAST(SCOPE_IDENTITY()  AS BIGINT) AS [id]");
        }

      

        public override string GetPagedTemplate()
        {
            return "SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY {OrderBy}) AS PagedNumber, {SelectColumns} FROM {TableName} {WhereClause}) AS u WHERE PagedNUMBER BETWEEN (({PageNumber}-1) * {RowsPerPage} + 1) AND ({PageNumber} * {RowsPerPage})";
        }


    }
}
